package com.scalar.chiptrack.commons;

import java.util.Map;

/**
 * User: Sujan
 * Date: Jan 20, 2009
 * Time: 3:36:29 PM
 */
public class ScreenFieldProperties
{
    private Map fieldProperties;
    private String screenName;


    public Map getFieldProperties() {
        return fieldProperties;
    }

    public void setFieldProperties(Map fieldProperties) {
        this.fieldProperties = fieldProperties;
    }

    public String getScreenName() {
        return screenName;
    }

    public void setScreenName(String screenName) {
        this.screenName = screenName;
    }

    public FieldProperty getFieldProperty( String fieldName )
    {
        FieldProperty fieldProperty = null;
        if ( fieldProperties != null )
        {
            fieldProperty = (FieldProperty)fieldProperties.get( fieldName == null ? null : fieldName.toUpperCase() );
        }
        if ( fieldProperty == null )
        {
            fieldProperty = new FieldProperty();
            fieldProperty.setScreenName( screenName );
            fieldProperty.setFieldName( fieldName );
            fieldProperty.setDisplay( true );
        }
        return fieldProperty;
    }
    public boolean isDisplay( String fieldName )
    {
        FieldProperty fieldProperty = getFieldProperty( fieldName );
        return ( fieldProperty == null ) ? true : fieldProperty.isDisplay();
    }
}
